﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
using CodeBuilder2.DBM;

namespace CodeBuilder2.DAL.ExecuteSQL
{
    class ExecuteSQLStringDAL
    {
        internal DataSet ExecuteSQL(string sql, out List<string> messages)
        {
            DataSet ds = null;
            using (SqlConnection conn = DBManager.SqlConn)
            {
                SqlCommand cmd = conn.CreateCommand();
                cmd.CommandText = sql;
                conn.Open();
                SqlDataReader reader = cmd.ExecuteReader();
                ds = new DataSet();
                ds.Load(reader, LoadOption.PreserveChanges, new string[] { });
            }
            messages = new List<string>();
            return ds;
        }
    }
}
